package at.sysarch.utils;

import javax.media.jai.KernelJAI;

public class KernelHelper {

	public static KernelJAI getKernel(int width, int height) {
		
		float[] kernelMatrix = new float[width * height];
		
		for (int i = 0; i < width; i++) {
			
			for (int j = 0; j < height; j++) {
				
				if (j == 0 || j == height -1) {
					
					kernelMatrix[i * j] = 0;
				}
				else if (i == 0 || i == width - 1) {
					
					kernelMatrix[i * j] = 0;
				} else {
					
					kernelMatrix[i * j] = 1;
				}
			}
		}
		
		return new KernelJAI(width, height, kernelMatrix);
	}
}
